import java.util.Calendar;
import java.util.Scanner;

public class Calculator {
    double s1, s2;
    int num;

    public void compute() {
        Scanner in = new Scanner(System.in);
        boolean bool = false;
        while (bool) {
            System.out.println("请输入第一个整数：");
            s1 = in.nextDouble();
            System.out.println("请输入第二个整数：");
            s2 = in.nextDouble();
            System.out.println("1.加,2.减,3.乘,4.除\\n请选择:");
            num = in.nextInt();
            switch (num) {
                case 1:
                    System.out.println("加法:" + s1 + "+" + s2 + "=" + (s1 + s2));
                    break;
                case 2:
                    System.out.println("加法:" + s1 + "-" + s2 + "=" + (s1 - s2));
                    break;
                case 3:
                    System.out.println("加法:" + s1 + "*" + s2 + "=" + (s1 * s2));
                    break;
                case 4:
                    if (s2 == 0) {
                        System.out.println("除数不能为0");
                    } else {
                        System.out.println("除法:" + s1 + "/" + s2 + "=" + (s1 / s2));
                    }
            }
        }
        System.out.println("是否继续计算(y/n)");
        String a = in.next();
        if ("y".equalsIgnoreCase(a)) {
            bool = true;
        } else {
            bool = false;
        }
    }

    public static void main(String[] args) {
        Calculator c = new Calculator();
        c.compute();
    }
}
